package com.xjzp.business.db.dao.impl;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.LinkedHashMap;
import java.util.Map;

import org.springframework.jdbc.core.RowCallbackHandler;
import org.springframework.jdbc.core.simple.SimpleJdbcDaoSupport;

import com.xjzp.business.db.dao.ITbTestSubjectDao;

public class TbTestSubjectDao extends SimpleJdbcDaoSupport implements ITbTestSubjectDao {
	
	public Map<String, String> getSubjectMap(){
		final Map<String, String> map = new LinkedHashMap<String, String>();
		String sql = "select * from tb_test_subject";
		getJdbcTemplate().query(sql, new RowCallbackHandler(){
			public void processRow(ResultSet rs) throws SQLException {
				map.put(rs.getString("id"), rs.getString("subject_name"));
			}
		});
		return map;
	}
	
}
